package Bill.app.serveur;


import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Vector;

import Bill.util.Configuration;

class ServeurGroup extends Thread
{

    ServeurGroup(java.awt.List ECRAN)
    {
        this.ECRAN = null;
        table = new Vector();
        this.ECRAN = ECRAN;
        start();
    }

    public void run()
    {
        try
        {Configuration.loadConfiguration();
            ServerSocket server = new ServerSocket(Configuration.Config_portServeurGroup);
            ECRAN.addItem((new StringBuilder("serveur   groupe lanc\351 sur le port :")).append(server.getLocalPort()).toString());
            do
            {
                Socket soc = server.accept();
                ECRAN.addItem((new StringBuilder("UN CLIENT VIENT DE SE CONNECTER  son port:=")).append(soc.getPort()).append("  son IP:").append(soc.getInetAddress()).toString());
                connecte++;
                new GroupTraitement(soc, table, connecte);
            } while(true);
        }
        catch(IOException e)
        {
            ECRAN.addItem((new StringBuilder()).append(e).toString());
        }
    }

    static Vector table = null;
    java.awt.List ECRAN;
    public static long connecte = 0L;
    int Config_portServeurGroup; 
   
}
